package com.zsf.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet Filter implementation class LoginFilter
 */
public class LoginFilter implements Filter {


	/**
	 * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
	 */
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest req=(HttpServletRequest)request;
		HttpServletResponse res=(HttpServletResponse)response;
		String path=req.getRequestURL().substring(req.getRequestURL().lastIndexOf("/")+1);
		Object obj=req.getSession().getAttribute("current_user");
		Object obj2=req.getSession().getAttribute("current_admin");
		if(obj==null&&obj2==null){
			if("login.jsp".equals(path)||("login").equals(path)){
				
			}
		}
		chain.doFilter(request, response);
	}

}
